package com.dilidili.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;

/**
 * @PackgeName: com.dilidili.entity
 * @ClassName: User
 * @Author: 零
 * Date: 2022/4/2 14:40
 * project name: spring-cloud-mybilibli
 * @Version: 11111
 * @Description:
 */
@AllArgsConstructor
@Data
@NoArgsConstructor
public class User implements UserDetails {
    private Integer userId;//用户表主键id
    private String userPassword; //用户密码
    private String userTel; //用户手机号
    private String userNickname; //用户昵称
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GBK+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date user_createtime; //用户创建时间
    private Integer userClass;//用户等级
    private String userClosetime;//用户退出时间;
    private String userImgsrc; //用户头像
    private String userSuggest;//用户介绍
    private boolean isAccountNonExpired=true;
    private boolean isAccountNonLocked=true;
    private boolean isCredentialsNonExpired=true;
    private boolean isEnabled=true;
    private Collection<? extends GrantedAuthority> authorities;

    @Override
    public String getPassword() {
        return userPassword;
    }

    @Override
    public String getUsername() {
        return userTel;
    }

}
